package com.dkd.flow.controller;
import com.alibaba.fastjson2.JSONObject;
import com.dkd.common.core.controller.BaseController;
import com.dkd.common.core.domain.AjaxResult;
import com.dkd.flow.service.impl.EProcessApproverServiceImpl;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/flow/approver")
@Api(value = "审批创建", tags = "审批创建")
public class EProcessApproverController extends BaseController {
    @Autowired
    EProcessApproverServiceImpl eProcessApproverService;
    /**
     * 获取审批创建详细信息
     *
     * @throws JsonProcessingException
     * @throws JsonMappingException
     */
    @GetMapping(value = "/{id}")
    @ApiOperation(value = "获取审批创建详细信息", notes = "获取审批创建详细信息")
    public AjaxResult getInfo(@PathVariable("id") Long id) throws JsonMappingException, JsonProcessingException {
        JSONObject result = eProcessApproverService.getInfo(id);
        return success(result);
    }
    /**
     * 新增审批，修改审批，现在主要是更新json
     *
     * @throws JsonProcessingException
     */
    @PostMapping
    @ApiOperation(value = "新增审批", notes = "新增审批")
    public AjaxResult add(@RequestBody JSONObject approver) throws JsonProcessingException {
        JSONObject result = eProcessApproverService.add(approver);
        return success(result);
    }
}
